﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace WeChatParking.Core.Payment.WeixinPay
{
    /// <summary>
    /// 查询订单请求实体
    /// </summary>
    public class WxpayQueryOrderRequest
    {
        /// <summary>
        /// 公众账号ID  appid  必填
        /// </summary> 
        [XmlElement("appid")]
        public string AppID { get; set; }

        /// <summary>
        ///  商户号 mch_id 必填 
        /// </summary>  
        [XmlElement("mch_id")]
        public string MchID { get; set; }

        /// <summary>
        /// 微信订单号 transaction_id 选填
        /// </summary> 
        [XmlElement("transaction_id")]
        public string TransactionID { get; set; }

        /// <summary>
        /// 商户订单号 out_trade_no 选填
        /// </summary> 
        [XmlElement("out_trade_no")]
        public string OutTradeNo { get; set; }

        /// <summary>  
        /// 随机字符串 nonce_str 必填 
        /// </summary>
        [XmlElement("nonce_str")]
        public string NonceStr { get; set; }
        /// <summary>
        /// 签名  sign 必填 
        /// </summary>
        [XmlElement("sign")]
        public string Sign { get; set; }

        public WxpayQueryOrderRequest()
        {
            AppID = WxpayConfig.AppID;
            MchID = WxpayConfig.MchID;
            NonceStr = WxpayHelper.GetNoncestr();
        }

        public IDictionary<string, string> GetParameters()
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("appid", this.AppID);
            parameters.Add("mch_id", this.MchID);
            parameters.Add("transaction_id", this.TransactionID);
            parameters.Add("out_trade_no", this.OutTradeNo);
            parameters.Add("nonce_str", this.NonceStr);
            parameters.Add("sign", this.Sign);
            return parameters;
        }

    }
}
